import { _decorator, Component, Widget } from "cc";
import { GameConfig } from "../data/GameConfig";

const { ccclass, property } = _decorator;

@ccclass("MarginBottom")
export class MarginBottom extends Component {
    private _bottom: number = 0;
    protected onLoad(): void {
        this._bottom = this.getComponent(Widget)?.bottom;
    }
    protected start(): void {
        const widget = this.getComponent(Widget);
        if (widget?.isAlignBottom) {
            widget.bottom = this._bottom + GameConfig.marginBottom;
        }
    }
}